"""
    Decorators for partner gate responses
"""
from flask import make_response


def gate_response(expires, max_age, content_type="text/javascript"):
    """decorator for a partner gate response"""
    def decorator(func):
        """decorator function for a standard response from pgate"""
        from functools import update_wrapper

        def gate_request(*args, **kwargs):
            """Set the appropriate headers"""
            resp = make_response(func(*args, **kwargs))
            resp.headers['Content-type'] = content_type
            resp.headers['Expires'] = expires
            resp.headers['Cache-Control'] = 'max-age=%s' % str(max_age)
            return resp

        return update_wrapper(gate_request, func)
    return decorator
